<template>
    <div class="cc-login">
        <van-nav-bar title="登 录">
            <template #left>
                <span>返回</span>
            </template>
            <template #right>
                <van-icon name="star-o" color="#333" size="20px" />
                <van-icon name="setting-o" color="#333" size="20px" />
            </template>
        </van-nav-bar>

        <van-form @submit="handleLogin">
            <van-cell-group inset>
                <van-field v-model="adminName" name="adminName" label="用户名" placeholder="用户名"
                    :rules="[{ required: true, message: '请填写用户名' }]" />
                <van-field v-model="adminPwd" type="password" name="adminPwd" label="密码" placeholder="密码"
                    :rules="[{ required: true, message: '密码不能为空' }]" />
            </van-cell-group>
            <div style="margin: 16px;">
                <van-button round block type="primary" native-type="submit">
                    登 录
                </van-button>
            </div>
        </van-form>
    </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()
const adminName = ref('')
const adminPwd = ref('')

const handleLogin = (val)=>{
    console.log(val)
    router.push('/main')
}
</script>

<style scoped></style>